package org.berlin.octane2m.kernel;

/**
 * Declaration of the process table.  It contains all process
 * data, including registers, flags, scheduling priority, memory map, 
 * accounting, message passing (IPC) information, and so on. 
 *
 * Many assembly code routines reference fields in it.  The offsets to these
 * fields are defined in the assembler include file sconst.h.  When changing
 * struct proc, be sure to change sconst.h to match.
 */
public class Proc {

    /* Bits for the runtime flags. A process is runnable iff p_rts_flags == 0. */
    public static final int SLOT_FREE =   0x01;    /* process slot is free */
    public static final int NO_MAP =      0x02;    /* keeps unmapped forked child from running */
    public static final int SENDING =     0x04;    /* process blocked trying to SEND */
    public static final int RECEIVING =   0x08;    /* process blocked trying to RECEIVE */
    public static final int SIGNALED =    0x10;    /* set when new kernel signal arrives */
    public static final int SIG_PENDING = 0x20;    /* unready while signal being processed */
    public static final int P_STOP =      0x40;    /* set when process is being traced */
    public static final int NO_PRIV =     0x80;    /* keep forked system process from running */

    /* Scheduling priorities for p_priority. Values must start at zero (highest
     * priority) and increment.  Priorities of the processes in the boot image 
     * can be set in table.c. IDLE must have a queue for itself, to prevent low 
     * priority user processes to run round-robin with IDLE. 
     */
    public static final int NR_SCHED_QUEUES = 16;    /* MUST equal minimum priority + 1 */
    public static final int TASK_Q =         0;      /* highest, used for kernel tasks */
    public static final int MAX_USER_Q =         0;  /* highest priority for user processes */   
    public static final int USER_Q =        7;       /* default (should correspond to nice 0) */   
    public static final int MIN_USER_Q =    14;      /* minimum priority for user processes */
    public static final int IDLE_Q =        15;      /* lowest, only IDLE process goes here */
    
} // End of the class //
